<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>index</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            width: 100vw;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }

        .outer {
            width: 370px;
            height: 320px;
            border: 1px solid red;
            position: relative;
            overflow: hidden;
        }

        .inner {
            width: 4440px;
            position: absolute;
            transform: translateX(0);
        }

        img {
            display: block;
            width: 370px;
            height: 320px;
            float: left;
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class="inner">
            <img src="./images/stamp2_hans_001.png"/>
            <img src="./images/stamp2_hans_003.png"/>
            <img src="./images/stamp2_hans_005.png"/>
            <img src="./images/stamp2_hans_006.png"/>
            <img src="./images/stamp2_hans_013.png"/>
            <img src="./images/stamp2_hans_014.png"/>
        </div>
    </div>
    <div>
        <button class="prev">上一张</button>
        <button class="next">下一张</button>
    </div>
</body>
<script src="./scripts/jquery-3.5.1.min.js"></script>
<script>
    let inner = $('.inner');
    inner.append(inner.html());

    let prev  = $('.prev');
    let next  = $('.next');
    let len = $('img').length;
    let index = 0;

    prev.click(function () {
        if (index === 0) {
            index = len / 2;
            inner.css({
                transition: 'all 0s linear',
                transform: `translateX(-${370 * index}px)`,
            });
        }
        index--;
        setTimeout(() => {
            inner.css({
                transition: 'all 1s linear',
                transform: `translateX(-${370 * index}px)`,
            });
        }, 0);
        console.log(index);
    });
    next.click(function () {
        if (index === len - 1) {
            index = len / 2 - 1;
            inner.css({
                transition: 'all 0s linear',
                transform: `translateX(-${370 * index}px)`,
            });
        }
        index++;
        setTimeout(() => {
            inner.css({
                transition: 'all 1s linear',
                transform: `translateX(-${370 * index}px)`,
            });
        }, 0);
        console.log(index);
    });
</script>
</html>